<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
  <!ENTITY dc "http://purl.org/dc/elements/1.1/">
  <!ENTITY dcterms "http://purl.org/dc/terms/">
  <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
  <!ENTITY a "http://xmlns.heustics.org/schema/myelin/0.1/">
  <!ENTITY m "http://xmlns.heustics.org/ontology/myelin/0.1/">
]>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:a="http://xmlns.heustics.org/schema/myelin/0.1/" 
  xmlns:l="http://xmlns.heustics.org/schema/i18n/0.1/"
  xmlns:date="http://exslt.org/dates-and-times"
  xmlns:xf="http://www.w3.org/2002/xforms" 
  xmlns:o="http://xmlns.heustics.org/schema/myelin/0.1/Document#preferences"
  xmlns:fhttp="http://xmlns.4suite.org/4ss/http"
  extension-element-prefixes="fhttp" 
  exclude-result-prefixes="xsl a l date o xf"
> 
  <xsl:variable name="o:l10n" select="a:get-l10n('&a;GuestAccount#preferences')"/>
  <xsl:variable name="o:params-l10n" select="$o:l10n/l:context[@name='params']/*"/>
  <xsl:variable name="o:hints-l10n" select="$o:l10n/l:context[@name='param-hints']/*"/>
  <xsl:variable name="o:submits-l10n" select="$o:l10n/l:context[@name='submits']/*"/>
  <xsl:variable name="o:titles-l10n" select="$o:l10n/l:context[@name='titles']/*"/>
  
  <xsl:template match="a:title[@key='edit-preferences']" mode="a:head-content">
    <xsl:call-template name="a:head-title">
      <xsl:with-param name="title" select="$o:titles-l10n[1]"/>
    </xsl:call-template>
  </xsl:template>
  
  <xsl:template match="a:title[@key='edit-preferences']" mode="a:page-header">
    <xsl:call-template name="a:page-header-title">
      <xsl:with-param name="title" select="$o:titles-l10n[1]"/>
    </xsl:call-template>
  </xsl:template>        
  
  <xsl:template match="a:form" mode="a:form-header">
    <xsl:param name="key" select="@status-type"/>
    <xsl:param name="l10n" select="$o:l10n/l:context[@name='status-types']/*"/>
    <xsl:variable name="status" select="$l10n[@key=$key]"/>
    <xsl:choose>
      <xsl:when test="$status">
        <div class="entry status">
          <span><xsl:value-of select="$status"/></span>
          <div class="spacer"/>
        </div>
      </xsl:when>
      <xsl:otherwise>
        <xsl:call-template name="a:form-header"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
    
  <xsl:template match="@node-id" mode="a:input-show"/>
  <xsl:template match="a:agent[@node-id]" mode="a:input-show"/>
  
  <xsl:template match="a:xlocale" mode="a:input-show">
    <xsl:call-template name="a:locale-select-input">
      <xsl:with-param name="label" select="$o:params-l10n[@key='locale']"/>
      <xsl:with-param name="hint" select="$o:hints-l10n[@key='locale']"/>
    </xsl:call-template>
  </xsl:template>
  
  <xsl:template match="a:xtheme" mode="a:input-show">    
    <xsl:param name="l10n"/>  
    <xsl:call-template name="a:xtheme">
      <xsl:with-param name="label" select="$o:params-l10n[@key='theme']"/>
      <xsl:with-param name="hint" select="$o:hints-l10n[@key='theme']"/>
    </xsl:call-template>
  </xsl:template>
  
  <xsl:template match="a:xtimezone" mode="a:input-show">  
    <xsl:param name="label"/>
    <xsl:param name="hint"/>
    <xsl:param name="l10n" select="a:get-l10n('http://xmlns.heustics.org/schema/standards/utc')/l:context[@name='timezone']/*"/>
    <div class='input text xtimezone'>  
      <div class="key">
        <div>
          <xsl:call-template name="a:label-class-attr"/>
          <span>
            <xsl:value-of select="$o:params-l10n[@key='timezone']"/>
          </span>
          <div class="spacer"/>
        </div>        
        <div class='hint'>
          <xsl:call-template name="a:input-hints">
            <xsl:with-param name="hint" select="$o:hints-l10n[@key='timezone']"/>
          </xsl:call-template>
          <div class="spacer"/>
        </div>
        <div class="spacer"/>
      </div>      
      <div class='value'>        
        <select name="xtimezone">   
          <xsl:variable name="sel" select="@selected"/> 
          <xsl:for-each select="$l10n">
            <option value="{@key}">
              <xsl:if test="$sel = @key">
                <xsl:attribute name="selected">selected</xsl:attribute>
              </xsl:if>
              <xsl:value-of select="."/>
            </option>
          </xsl:for-each>          
        </select>     
        <div class="spacer"/>   
      </div>
      <div class='spacer'/>
    </div>
  </xsl:template>
  
  <xsl:template match="a:submit[@key='commit']">    
    <xsl:param name="name"/>    
    <xsl:param name='key' select='@key'/>
    <div class="input submit">
      <xsl:variable name='val' select='$o:submits-l10n[@key=$key]'/>
      <input type='hidden' name='{$key}' value='{$val}'/>
      <input type='submit' name='{$name}' value='{$val}'/>
      <div class='spacer'/>
    </div>        
  </xsl:template>
  
  <xsl:template match="*" mode="a:form-related-request">
    <xsl:param name="l10n" select="$o:l10n/l:context[@name='form-related-requests']/*"/>
    <xsl:call-template name="a:form-reset-request">
      <xsl:with-param name="l10n" select="$l10n"/>
      <xsl:with-param name="key" select="'reset'"/>
    </xsl:call-template>
  </xsl:template>
  
</xsl:stylesheet>

